package com.nb.sse.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.nb.sse.entity.SysNotice;
import com.nb.sse.mapper.SysNoticeMapper;
import com.nb.sse.service.ISysNoticeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 作者
 * @since 2024-07-14
 */
@Service
public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice> implements ISysNoticeService {

    @Override
    public int countUnReadByUserId(Integer userId) {
        LambdaQueryWrapper<SysNotice> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(SysNotice::getReceiverUserId,userId)
                .eq(SysNotice::getReadFlag,0);
        return (int)count(wrapper);
    }
}
